#include "pot.h"

#include "atd.h"

static const int pot::cNewState=1;
static const int pot::cOldState=1;


pot::pot(int ch) : _channel(ch)
{
  _state = atd_read(_channel);
}


void pot::scan()
{

  _readValue = atd_read(_channel);
 
 //version avec decalages
 //_state = _state<<1 + _readValue<<1;
 
 //version avec divisions d'entiers
 //_state = _state/2 + _readValue/2;
 
 //version avec division de flottants
 _state = (float)_state*0.5 + (float)_readValue*0.5;
}

int pot::state() const
{
  return _state;
}
